home *** CD-ROM | disk | FTP | other *** search
- unit OtherU;
-
- interface
-
- uses
- WinProcs, WinTypes, Messages, SysUtils, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls;
-
- type
- TOtherForm = class(TForm)
- Label1: TLabel;
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- private
- procedure CreateParams(var Params: TCreateParams); override;
- end;
-
- implementation
-
- {$R *.DFM}
-
- procedure TOtherForm.CreateParams(var Params: TCreateParams);
- begin
- inherited CreateParams(Params);
- Params.WndParent := HWnd_Desktop
- end;
-
- procedure TOtherForm.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- { If the only forms left are this one }
- { being closed and the main form... }
- if Screen.FormCount = 2 then
- { ...then close the main form }
- Application.MainForm.Close;
- { Ensure this form is destroyed ASAP }
- Action := caFree;
- end;
-
- end.
-